package org.example.spring.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.spring.domain.pojo.User;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM users where username=#{username} and password=#{password}")
    User getUser(String username, String password);

    @Select("select * from users where username = #{username}")
    User findByUserName(String username);

    @Insert("insert into users (username,password,phone,address) values (#{username},#{password},#{phone},#{address})")
    void add(User u);


    @Update("update users set password=#{password} where user_id=#{userId}")
    void updatePwd(User u);
}
